<?php

namespace App\Services\Sms;

use App\Services\Sms\Drivers\LogSmsSender;
use App\Services\Sms\Drivers\TencentSmsSender;
use Illuminate\Support\Manager;
use Psr\Log\LoggerInterface;

class SmsSenderManager extends Manager
{
    public function getDefaultDriver()
    {
        return $this->config->get('sms.default', 'log');
    }

    protected function createLogDriver(): SmsSender
    {
        return new LogSmsSender($this->container->make(LoggerInterface::class));
    }

    protected function createTencentDriver(): SmsSender
    {
        $config = $this->config->get('sms.drivers.tencent', []);

        return new TencentSmsSender(
            $config,
            $this->container->make(LoggerInterface::class)
        );
    }
}
